#include <stdio.h>

int main()
{
    int s[] = {72, 6, 57, 88, 60, 42, 83, 73, 48, 85};
    int l = 0, r = 9;
    quick_sort(s, l, r);
    for(int i = 0; i < 10; i++)
    {
        printf("%d ", s[i]);
    }
    return 0;
}

void quick_sort(int s[], int l, int r)
{
    if(l < r)
    {
        int i = AdjustArray(s, l, r);
        quick_sort(s, l, i - 1);
        quick_sort(s, i + 1, r);
    }
}

int AdjustArray(int s[], int l, int r)
{
    int i = l, j = r;
    int x = s[l];
    while(i < j)
    {
        while(i < j && s[j] >= x)
            j--;
        if(i < j)
        {
            s[i] = s[j];
            i++;
        }
        while(i < j && s[i] < x)
            i++;
        if(i < j)
        {
            s[j] = s[i];
            j--;
        }
        
    }

    s[i] = x;

    return i;
}